package com.quanz.ckgl.services.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * 角色信息
 * 
 * @author James Quan
 * @version 2015年10月3日 下午10:18:35
 */
@Entity
@Table(name = "AUTHORITIES")
public class AuthoritiesEntity implements Serializable {
	private Long id;
	private UserEntity user;
	private RoleEntity role;

	@Id
	@GeneratedValue(generator = "qsIdGenerator")
	@GenericGenerator(name = "qsIdGenerator", strategy = "org.hibernate.id.enhanced.TableGenerator", parameters = {
			@Parameter(name = "table_name", value = "CKGL_SEQUENCES"),
			@Parameter(name = "segment_column_name", value = "ID_NAME"),
			@Parameter(name = "value_column_name", value = "ID_VAL"),
			@Parameter(name = "segment_value", value = "AUTHORITIES"),
			@Parameter(name = "increment_size", value = "1") })
	@Column(name = "ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne()
	@JoinColumn(name = "USERID")
	public UserEntity getUser() {
		return user;
	}

	public void setUser(UserEntity user) {
		this.user = user;
	}

	@ManyToOne()
	@JoinColumn(name = "ROLEID")
	public RoleEntity getRole() {
		return role;
	}

	public void setRole(RoleEntity role) {
		this.role = role;
	}

}
